package com.hsck.order.kds.base.isnoam.view

import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.hsck.order.kds.R
import com.hsck.order.kds.base.isnoam.log.XFrame

/**
 * @author isnoam
 * @package_name BindingAdapters
 * @date 2024-10-08
 * @description：
 */
object BindingAdapters {
    @JvmStatic
    @BindingAdapter("timeTypeColor")
    fun setTimeTypeColor(textView: TextView, timeType: Int) {
        val color = when (timeType) {
            0 -> XFrame.getColor(R.color.black21)
            1 -> XFrame.getColor(R.color.color_FA6A37)
            2 -> XFrame.getColor(R.color.color_F64040)
            else -> XFrame.getColor(R.color.black21)
        }
        textView.setTextColor(color)
    }

    @JvmStatic
    @BindingAdapter("itemSelected")
    fun setItemSelected(imageView: ImageView, selected: Boolean) {
        if (selected) {
            imageView.setImageDrawable(XFrame.getDrawable(R.mipmap.selected_icon))
        } else {
            imageView.setImageDrawable(XFrame.getDrawable(R.mipmap.default_icon))
        }
    }
    @JvmStatic
    @BindingAdapter("selectedAll")
    fun isSelectedAll(imageView: ImageView, selected: Boolean) {
        if (selected) {
            imageView.setImageDrawable(XFrame.getDrawable(R.mipmap.block_selected_icob))
        } else {
            imageView.setImageDrawable(XFrame.getDrawable(R.mipmap.block_default_icon))
        }
    }
}
